<?php 
$show_validator = true;
include TMPL_PATH.'public/header.phtml';
?>
<script src="/statics/js/plugins/artDialog/jquery.artDialog.js?skin=default"></script>
<script src="/statics/js/plugins/artDialog/plugins/iframeTools.js"></script>
<div class="subnav">
    <div class="content-menu ib-a blue line-x">
        <a href='<?php echo U('order/order_list');?>' ><em>订单列表</em></a><span>|</span><a href='javascript:;' class="on"><em>订单信息</em></a></div>
</div>
<script type="text/javascript">
function quick_add(item_id){
	art.dialog.data('width', 300);
	art.dialog.data('height', 450);
	art.dialog.open('<?php echo U('order/edit_attr_code');?>&item_id='+item_id,{lock:true,title:'修改绣字',width:600,height:400,yesText:'关闭',background: '#000',opacity: 0.45});
	
}
</script>
<style type='text/css'>
.table_form tbody td{ border: 1px solid #EEEEEE;}
.division {
    background: none repeat scroll 0 0 #FFFFFF;
    border-color: #CCCCCC #BEC6CE #BEC6CE #CCCCCC;
    border-style: solid;
    border-width: 1px 2px 2px 1px;
    line-height: 150%;
    white-space: normal;
}
.division table {
    margin: 0;
    padding: 0;
}
.division th, .division td {
    border-color: #FFFFFF #DBE2E7 #DDDDDD #FFFFFF;
    border-left: 1px solid #FFFFFF;
    border-right: 1px solid #DBE2E7;
    border-style: solid;
    border-width: 1px;
    padding: 5px;
    vertical-align: top;
}
.division th {
    background: none repeat scroll 0 0 #E2E8EB;
    border-right: 1px solid #CCCCCC;
    font-size: 14px;
    text-align: right;
    white-space: nowrap;
    width: 140px;
}
.gridlist th{
	text-align:center;
	font-weight: bold;
	font-size: 12px;
}
.order_th{font-size: 14px; color: rgb(0, 0, 0); font-weight: bold; margin: 10px;overflow:hidden;}
</style>

<div class="pad-10" style="padding-top:0px;">
<form name="myform" id="myform" action="__SELF__" method="post">
<input type="hidden" value="<?php echo $order['id']?>" name="id" id="order_id">
<div class="col-tab">
<div class="order_th">订单信息</div>
<div id="div_setting_1" class="contentList division pad-10">
<table width="100%" class="table_form">
	<tbody>
	<tr> 
		<th width="10%">订单号：</th> 
		<td width="40%"><?php echo $order['order_sn']?> <?php if($order['is_cheat']==2){echo ' <font color="red">疑似欺诈订单</font>';}?></td> 
		<th width="10%">下单日期：</th> 
		<td width="40%"><?php echo date('Y-m-d H:i:s', $order['start_time']);?></td>
	</tr>
	<?php if( $order['is_gift_orders']==0){ //判断是否为礼品订单?>
	<tr> 
		<th>商品总金额：</th> 
		<td><input disabled="disabled" value="<?php echo $order['product_amount']?>" name="product_amount" id="product_amount"></td>
		<th>应付金额：</th> 
		<td><input disabled="disabled" value="<?php echo $order['pay_amount']?>" name="pay_amount" id="pay_amount"></td>
	</tr>
	<?php } ?>
	<tr>
		<th>订单状态：</th> 
		<td> <select name="order_status">
		<?php 
				foreach (OrderModel::$orderStatusCn as $os_key => $os_val):
			?>
			<option <?php if($os_key == $order['order_status'])echo 'selected="selected"';?> value="<?php echo $os_key?>"><?php echo $os_val;?></option>
			<?php 
				endforeach;
			?>
		</select></td>
		<th>支付状态：</th> 
		<td> <select name="payment_status">
		<?php 
				foreach (OrderModel::$paymentStatus as $ps_key => $ps_val):
			?>
			<option <?php if($ps_key == $order['payment_status'])echo 'selected="selected"';?> value="<?php echo $ps_key?>"><?php echo $ps_val;?></option>
			<?php 
				endforeach;
			?>
		</select></td>
	</tr>
	<?php if( $order['is_gift_orders']==0){ //判断是否为礼品订单?>
	<tr>
		<th>支付方式：</th> 
		<td> <select name="payment_method">
		<?php 
			if(isset($paymentList) && $paymentList):
				foreach ($paymentList as $payment):
					if($payment['status'] == false) continue;
			?>
			<option <?php if($payment['name'] == $order['payment_method'])echo 'selected="selected"';?> value="<?php echo $payment['name']?>"><?php echo $payment['title'];?></option>
			<?php 
				endforeach;
			endif;
			?>
		</select></td>
		<th>支付手续费：</th> 
		<td><input type="text" disabled="disabled" value="<?php echo $order['payment_fee'];?>" size="10" name="payment_fee" id="payment_fee" class="x-input item itemrow"></td> 
	</tr>
	<?php } ?>
	<tr>
		<th>配送方式：</th> 
		<td><select name="shipping_method">
			<?php 
			if(isset($shippingList) && $shippingList):
				foreach ($shippingList as $shipping):
			?>
			<option <?php if($shipping['name'] == $order['shipping_method'])echo 'selected="selected"';?> value="<?php echo $shipping['name']?>"><?php echo $shipping['title'];?></option>
			<?php 
				endforeach;
			endif;
			?>
			</select></td>
		<th>配送状态：</th> 
		<td> <select name="shipping_status">
		<?php
		 	if( $order['is_gift_orders']==0) { //判断是否为礼品订单
				$shippingStatus_list = OrderModel::$shippingStatus;
			}else{
				$shippingStatus_list = OrderModel::$giftshippingStatus;
			}
			foreach ($shippingStatus_list as $ss_key => $ss_val):
		?>
			<option <?php if($ss_key == $order['shipping_status'])echo 'selected="selected"';?> value="<?php echo $ss_key?>"><?php echo $ss_val;?></option>
		<?php
			endforeach;
		?>
		</select></td>
	</tr>
	<tr>
		<th>物流编号：</th> 
		<td><?php echo $order['shipping_no']?></td>
		<th>配送费用：</th> 
		<td><input type="text" disabled="disabled" size="10" value="<?php echo $order['shipping_fee']?>" name="shipping_fee" id="shipping_fee" class="x-input item itemrow"></td>
	</tr>
	</tbody>
</table>
</div>
<?php if(isset($user) && $user):?>
<div class="order_th">会员信息</div>
<div id="div_setting_1" class="contentList division pad-10">
	<table width="100%" class="table_form">
	<tbody>
	<tr>
	 <th width="10%">会员姓名：</th> 
	 <td width="40%"><?php echo (isset($user['first_name']) ? $user['first_name'] : null) . (isset($user['last_name']) ? '   ' .$user['last_name'] : null);?></td> 
	 <th width="10%">联系电话：</th> 
	 <td width="40%"><?php echo (isset($user['phone']) ? $user['phone'] : null).(isset($user['mobile']) ? ' / '.$user['mobile'] : null);?></td> 
	</tr> 
	<tr>
	 <th>会员名称：</th> 
	 <td><?php echo (isset($user['username']) ? $user['username'] : '匿名用户');?></td>
	 <th>Email地址：</th> 
	 <td><?php echo (isset($user['email']) ? $user['email'] : null);?></td> 
	</tr> 
	</tbody>
	</table>
</div>
<?php endif;?>
<div class="order_th">收货地址信息
<?php //if($order['payment_status']==OrderModel::PAY_UNPAYED && $order['order_status'] == OrderModel::ORDER_UNCONFIRMED){?>
<span style="margin-left:50px;"><a href='<?php echo U('order/order_address_edit', 'oid='.$order['id']);?>' style="color:red">[编辑收货信息]</a></span>
<?php //}?>
</div>
<div id="div_setting_4" class="contentList division pad-10 ">
<table width="100%" cellspacing="0" cellpadding="0" border="0" class="table_form"> 
	<tbody>
	<tr>
		<th width="10%">收货国家：</th> 
	 	<td width="40%"><?php echo $order['delivery_country'];?></td>
 		<th width="10%">收货姓名：</th> 
 		<td width="40%"><?php $name=$order['delivery_first_name']."&nbsp;&nbsp;".$order['delivery_last_name'];?><?php  echo $name;?></td> 
 	</tr> 
 	<tr>
 		<th>收货省份：</th> 
 		<td><?php echo $order['delivery_province'];?></td> 
 		<th>收货城市：</th> 
		<td><?php echo $order['delivery_city'];?></td> 
 	</tr> 

 	<tr>
 		<th style="vertical-align: middle">收货地址：</th> 
		<td style="vertical-align: middle"><?php echo $order['delivery_address'];?><br>
		<?php echo $order['delivery_address2'];?><br>
 		<?php echo $order['delivery_address3'];?></td>
		<th style="vertical-align: middle">邮政编码：</th> 
		<td style="vertical-align: middle"><?php echo $order['delivery_postcode'];?></td> 
	</tr>
	<tr>
		<th>联系电话：</th> 
		<td><?php echo $order['delivery_phone'];?></td> 
		<th>Email地址：</th> 
		<td><?php echo $order['delivery_email'];?></td> 
	</tr>

 	<tr>
 		<th>缺货处理：</th> 
 		<td colspan="3"><?php if($order['stockout']==1){?> 等待货物到齐后在一起发<?php }elseif($order['stockout']==0){ ?> 先发有货的商品<?php } ?></td> 
 	</tr> 
 	<tr>
 		<th>留言：</th> 
 		<td colspan="3" style="color:red"><?php echo $order['remark']?></td>
	</tr>
	<tr>
 		<th>留言回复：</th> 
 		<td style="color:red"><textarea name="data[replay]" style="width: 760px; height: 52px;"><?php echo $order['data']['replay']?></textarea></td>
		<th>客户备注：</th>
		<td style="color:red"><?php echo $order['client_note']?></td>
 	</tr>
 </tbody>
</table>
</div>
<?php if($order['delivery2_first_name'] && $order['delivery2_last_name']): ?>
<div class="order_th">第二收货地址信息</div>
<div class="contentList division pad-10 ">
<table width="100%" class="table_form"> 
	<tbody>
	<tr>
		<th>国家：</th> 
	 	<td><?php echo $order['delivery2_country'];?></td>
		<th width="10%">姓名：</th> 
		<td width="40%"><?php echo $order['delivery2_first_name'];?>&nbsp;&nbsp;<?php echo $order['delivery2_last_name'];?> </td>

	</tr> 
 	<tr>
 		<th>省份：</th> 
 		<td><?php echo $order['delivery2_province'];?></td> 
 		<th>城市：</th> 
		<td><?php echo $order['delivery2_city'];?></td> 
 	</tr> 
 	<tr>
 		<th style="vertical-align: middle">地址：</th> 
 		<td style="vertical-align: middle"><?php echo $order['delivery2_address'];?><br><?php echo $order['delivery2_address2'];?><br><?php echo $order['delivery2_address3'];?></td> 
		<th style="vertical-align: middle">邮编：</th> 
		<td style="vertical-align: middle"><?php echo $order['delivery2_postcode'];?></td> 
	</tr>
	<tr>
		<th width="10%">电话：</th> 
		<td width="40%"><?php echo $order['delivery2_phone'];?></td>
		<th>邮箱：</th> 
		<td><?php echo $order['delivery2_email'];?></td> 
	</tr> 
 </tbody>
</table>
</div>
<?php endif; ?>
<div class="order_th">身形数据</div>
<?php if(isset($order['measure_data']) && $order['measure_data'] ):?>
<div class="contentList division pad-10 ">
<table width="100%" cellspacing="0" cellpadding="0" border="0" class="table_form"> 
	<tbody>
		<?php 
           	$data = unserialize($order['measure_data']);
           	$i=0;
           	foreach ($data as $key => $val){
           		if($i==0 || $i%5==0){
           			echo '<tr>';
           		}
           		echo '<th style="width:50px">'. $key.'</th><td>';
           		if(is_array($val)){
           			foreach ($val as $key2 => $val2){
           				if($key2=='type'){
           					echo $val2.'&nbsp;';
           				}else{
           					echo $val2.$key2.' ';
           				}
           			}
           		}else{
           			echo  $val;
           		}
           		echo  '</td>';
           		if(($i+1)%5==0){
           			echo '</tr>';
           		}
           		$i++;
           	}
           ?>
 </tbody>
</table>
</div>
<?php endif;?>
<div class="order_th">商品信息 
<?php //if($order['payment_status']==OrderModel::PAY_UNPAYED && $order['order_status'] == OrderModel::ORDER_UNCONFIRMED){?>
<span style="margin-left:50px;"><a href='<?php echo U('order/order_product_edit', 'oid='.$order['id']);?>' style="color:red">[编辑商品]</a></span>
<?php //}?></div>
<div id="div_setting_2" class="contentList division pad-10">
<div class="table-grid" style="border: 1px solid #efefef;">
	<table width="100%" cellspacing="0" cellpadding="2" border="0" class="gridlist" id="order_items"> 
		<thead> 
			<tr>
				<th style="width:10%;">货号</th>
				<th style="width:25%;">商品名称</th>
				<th style="width:30%;">身形数据</th>
				<th style="width:6%">下单备注</th>
				<th style="width:6%">特殊需求</th>
				<th style="width:5%;">设计师</th>
				<th style="width:5%;">价格</th>
				<th style="width:5%;">购买数量</th>
				<th style="width:5%;">小计</th>
				<th style="width:9%;">操作</th>
			</tr> 
		</thead> 
		<tbody>

		<?php 
		if(isset($order['product']) && $order['product']):
			foreach ($order['product'] as $key => $product):
		?>
		<?php 
			if($product['product_name']){
				$where_name = array('product_id'=>$product['product_id'],'language_id'=>6);
				$product_items = D('product_items')->where($where_name)->find();
			}	//var_dump($product_items);die;
            $suppliers = M('suppliers')->where(array('suppliers_id'=>$product['suppliers_id']))->find();
            if($suppliers){
                $product['attr'] .= ' ,面料编号: '.$suppliers['suppliers_name']; 
            }
		?>
			<tr> 
				<td align="center"><?php echo $product['product_sn'];?><br /><?php echo $product['order_id'].'-'.$product['id'];?></td> 
				<td style="word-break:break-all">
				<?php echo $product_items['name'];if($product['attr']){echo ' ( '. $product['attr'] . ' )';}?>
				<?php
                    if($product['pants_qty'] > 0){
                       echo "<hr />";
                       echo "加同款单裤:".$product['pants_qty']."条 (".$product['pants_price']."X".$product['pants_qty'].")";						    
                    }
                ?>               
                </td> 
				<td>
				<?php if(isset($product['measure_data']) && $product['measure_data'] ):?>
				<div class="contentList division pad-10 ">
				<?php if($product['model_id']!=25){?>
				<table width="100%" cellspacing="0" cellpadding="0" border="0" class="table_form">
					<tbody>
					<tr>
                    <th colspan="2">身形数据所有人：</th>
                        <td><?php echo $product['measure_data']['measure_name']?></td>
                    <th colspan="2">量体方式：</th>
                        <td colspan="2">
                                    <?php 
                                    $status = $product['measure_data']['m_status'];
                                        if ($status == 1) {
                                            echo '量尺量体';
                                        } else if ($status == 2) {
                                            echo '免量体';
                                        } else if ($status == 3) {
                                            echo '拍照量体';
                                        } else if ($status == 4) {
                                            echo '量尺并拍照';
                                        }else if ($status == 10) {
                                            echo '预约量体';
                                        }else if ($status == 5) {
											echo "成衣";
										}
                                    ?>
                        </td>
                        <th colspan="2"><?php
                            if($status == 10) {
                                echo "联系方式";
                            }else if($status == 5){
								echo "成衣尺码";
							}
                            ?></th>
                        <td><?php
                            if($status == 10) {
                                echo $product['measure_data']['name']."<br>".$product['measure_data']['mobile'];
                            }else if($status == 5){
								$measureInfo = AttributeModel::get_user_measure_info($product['measure_id']);
								foreach(unserialize($measureInfo['measure_data']) as $mskey=>$msval){ ?>
								<strong class="text-bold"><?php echo $msval;?></strong>
						<?php
								}
							}
                            ?></td>
                    </tr>
                            <tr>
                                <?php 
                                    $data = $product['measure_data']['measure_data'];
                                    echo "<tr><th style='width:50px'>年龄</th><td>{$product['measure_data']['age']}</td>"
                                    . "<th >身高</th><td>{$product['measure_data']['height']}cm</td>"
                                    . "<th >体重</th><td>{$product['measure_data']['weight']}kg</td>"
                                    . "<th style='width:50px'>上衣尺码</th><td>{$product['measure_data']['clothes_size']}</td>"
                                    . "<th style='width:50px'>裤子尺码</th><td>{$product['measure_data']['pants_size']}</td></tr>";
                                    if($status == 2){
                                        echo "<tr><td>chest</td><td>{$data['chest']['type']}</td><td>stomach</td><td>{$data['stomach']['type']}</td><td>shoulder</td><td>{$data['shoulder']['type']}</td><td>posture</td><td>{$data['posture']['type']}</td><td></td><td></td></tr>";
                                    }
                                    if(($status == 3 || $status == 4) || ($product['measure_data']['front_img'] && $product['measure_data']['side_img'])){
                                       echo  "<tr><td></td><td colspan='4'><img width=200 src='{$product['measure_data']['front_img']}'></td><td></td><td colspan='4'><img width=200 src='{$product['measure_data']['side_img']}'></td></tr>";
                                    }
                                    if($status == 1 || $status == 4||$status==10){
                                    $i=0;
                                    foreach ($data as $key => $val){
                                        if($i==0 || $i%5==0){
                                            echo '<tr>';
                                        }
                                        if(in_array($key,array('age','weight','height'))){
                                            continue;
                                        }
                                        echo '<th style="width:50px">'. $key.'</th><td>';
                                        if(is_array($val)){
                                            foreach ($val as $key2 => $val2){
                                                if($key2=='type'){
                                                    echo $val2.'&nbsp;';
                                                }else{
                                                    echo $val2.$key2.' ';
                                                }
                                            }
                                        }else{
                                            echo  $val;
                                        }
                                        echo  '</td>';
                                        if(($i+1)%5==0){
                                            echo '</tr>';
                                        }
                                        $i++;
                                        }
                                    }
                                   ?>
                    <?php //if($status == 10){?>
                       <tr><td colspan="10" align="center"><a href="javascript:edit(<?php echo $product['measure_data']['id']?>, '<?php echo $product['measure_data']['measure_name']?>',<?php echo $orderInfo['user_id'];?>,<?php echo $orderInfo['id'];?>)"> 修改身形数据</a></td></tr>
                    <?php //}?>
				 </tbody>
				</table>
				<?php }?>
				</div>
				<?php endif;?>
				</td>
				<td align="center" style="color: red"><?php echo $product['special_request_1'];?></td>
                <td align="center"><textarea name="special_request[<?php echo $product['id']?>]" rows="8"><?php echo $product['special_request'];?></textarea></td>
				<td align="center"><?php echo $product['designer_id'] ? $designerList[$product['designer_id']]['username'] : '--';?></td> 
				<td align="center"><?php echo $product['pay_price'];?></td> 
				<td align="center"><?php echo $product['qty'];?></td> 
				<td align="center"><?php echo $product['total_amount'];?></td> 

				<td align="center">
				<a href="javascript:openwinx('<?php echo U('order/order_print_figure_god', 'order_item_id='.$product['id']),'&name='.$name,'&uid='.$product['measure_id'];?>','order_print<?php echo rand(1000,9999);?>');">打印</a>
                <br /><br />
                <a href="javascript:openwinx('<?php echo U('order/order_print_figure_god', 'order_item_id='.$product['id']),'&uid='.$product['measure_id'];?>&font=1','order_print');">打印绣字</a>
                <?php if($product['code_show'] || $product['code_shows']){ ?>
                <br /><br />
                <a href="javascript:quick_add(<?php echo $product['id'];?>);" >修改绣字</a>
                 
                <?php } ?>  
                 <br/><br/><br/>
                <a href="javascript:void(0);" onclick="eidt_order_attribute(<?php echo $product['id'];?>,<?php echo $product['measure_id'];?>);">修改定制选项</a> 
                <br/><br/>
                <a href="javascript:void(0);" onclick="eidt_order_attribute_new(<?php echo $product['id'];?>,<?php echo $product['measure_id'];?>);">查看客人的选项</a>  
                 <br/><br/>
                <a href="javascript:void(0);" onclick="eidt_process_type(<?php echo $product['id'];?>);">修改工艺类型</a> 
                </td>
		<?php 
			endforeach;
		endif;
		?>
		<tr>
			<td colspan="9" style="text-align: right;width:100%">
			商品总金额：<?php echo $order['product_amount']?>
			</td>
		</tr>
		</tr>
		
		</tbody> 
	</table>	
</div></div>
	<div class="order_th">费用信息 </div>
	<div id="div_setting_2" class="contentList division pad-10">
<div class="table-grid" style="border: 1px solid #efefef;">
	<table width="100%" cellspacing="0" cellpadding="2" border="0" class="gridlist"  style="text-align: right;width:100%">
	 <tbody>
	 <tr>
			<td>
				商品总金额：<?php echo $order['product_amount']?>
				<?php if($order['payment_fee']){?>
        + 附加费用：<?php echo $order['payment_fee'];?>
        <?php } if($order['shipping_fee']){?>
         <!-- 配送费用 -->
        + 配送费用：<?php echo $order['shipping_fee'];?> 
        <?php }?>
				= 订单总金额：<?php echo $order['order_amount']?>
			</td>
		</tr>

<?php if(floatval($order['discount_amount']) != 0):?>
<tr><td>-优惠金额：<?php echo $order['discount_amount'];?></td></tr>
<?php elseif($order['payment_status'] == OrderModel::PAY_UNPAYED):?>
		<tr><td>-优惠金额：<input name="discount_amount" type="text" value="" id="discount_amount"><input type="button" value="提交" id="discount_amount_submit"></td></tr>
<?php endif;?>

		<tr>
			<td>
				<?php if($order['product_dingjin']>0 && $order['payment_status']>0):?>
					-定金：<?php echo $order['product_dingjin'];?>
				<?php endif;?>
				<?php if($order['hongbao_money']>0):?>
					-合作伙伴折扣：<?php echo $order['hongbao_money'];?>
				<?php endif;?>
				<?php if(($order['coupon_money']>0 && $coupon_info['status'] == 4) || $coupon_info['type'] == 4):?>
					-使用折扣优惠码 折扣率<?php echo $coupon_info['coupon_money']?>%：<?php echo $order['coupon_code'];?>
				<?php else:?>
					-使用优惠码编号：<?php echo $order['coupon_code'];?>
				<?php endif;?>
				<?php if($order['coupon_money']>0):?>
					-优惠码金额：<?php echo $order['coupon_money'];?>
				<?php endif;?>
		
				<?php if($order['surplus_money']){?>
        - 使用余额：<?php echo $order['surplus_money'];?>
        <?php }?>
				<?php if($order['integral_money']>0){?>
        - 使用积分：<?php echo $order['integral_money'];?>
        <?php }?>
				= 应付金额：<span id="pay_amount_html"><?php echo $order['pay_amount']?></span>
			</td>
		</tr>
	 	</tbody>
	</table>  
</div>
</div>
 <div class="bk15"></div>
<table width="100%" cellspacing="0" cellpadding="2" border="0" class="gridlist">
	 <tbody>
	 <tr>
	 		<th>订单操作备注：</th>
			<td>
				<textarea rows="3" cols="100" name="action_notice"></textarea>
			</td>
		</tr>
	 	</tbody>
	</table>  
 <div class="bk15"></div>
 <div style="text-align:center;">

   <input name="dosubmit" type="submit" value="提交" class="button"> &nbsp;&nbsp;&nbsp;
   <?php 
   	if($order['payment_status'] != OrderModel::PAY_UNPAYED):
   		if($order['deliveryHavingDeliverying']):
    ?>
    <input type="button" class="button" onclick="javascript:location.href='<?php echo U('order/order_delivery_add', 'oid='.$order['id']) ?>'" value="配货">
    <?php endif;?>
	<?php if($order['deliveryCount']):?>
		&nbsp;&nbsp;&nbsp;
		<input type="button" class="button" onclick="javascript:location.href='<?php echo U('order/order_delivery_list', 'oid='.$order['id']) ?>'" value="查看发货单">
	<?php endif;?>
	<?php //&& $order['shipping_status'] == OrderModel::SHIPPING_SHIPPED
	if($order['payment_status'] == OrderModel::PAY_PAYED ):?>
		<?php 
		$payt = D('orders_pay_return')->field('id,status')->where(array('order_id'=>$order['id'],'apple_type'=>0))->order('id desc')->find();
		if(!$payt):
		?>
        &nbsp;&nbsp;&nbsp;
		<input type="button" class="button" onclick="javascript:location.href='<?php echo U('order/pay_return_apply', 'apply_type=0&oid='.$order['id']) ?>'" value="申请退款">
        <?php elseif($payt['status']==3):?> 
        &nbsp;&nbsp;&nbsp;
		<input type="button" class="button" onclick="javascript:location.href='<?php echo U('order/pay_return_apply', 'apply_type=0&oid='.$order['id']) ?>'" value="退款申请被拒绝,重新申请">        
		<?php else:?> 
        &nbsp;&nbsp;&nbsp;
		<input type="button" class="button" onclick="javascript:location.href='<?php echo U('order/pay_return_edit', 'apply_type=0&pid='.$payt['id']) ?>'" value="查看退款详情">        
        <?php endif;?>   
	<?php endif;?>       
    <?php endif;?> 
	<?php if($order['shipping_status'] == OrderModel::SHIPPING_SHIPPED || $order['shipping_status'] == OrderModel::SHIPPING_SHIPPED_PART):?>
		<?php 
		$payt = D('orders_pay_return')->field('id,status')->where(array('order_id'=>$order['id'],'apple_type'=>1))->order('id desc')->find();
		if(!$payt):
		?>
        &nbsp;&nbsp;&nbsp;
		<input type="button" class="button" onclick="javascript:location.href='<?php echo U('order/pay_return_apply', 'apply_type=1&oid='.$order['id']) ?>'" value="申请重做">
        <?php elseif($payt['status']==3):?> 
        &nbsp;&nbsp;&nbsp;
		<input type="button" class="button" onclick="javascript:location.href='<?php echo U('order/pay_return_apply', 'apply_type=1&oid='.$order['id']) ?>'" value="重做申请被拒绝,重新申请">        
		<?php else:?> 
        &nbsp;&nbsp;&nbsp;
		<input type="button" class="button" onclick="javascript:location.href='<?php echo U('order/pay_return_edit', 'apply_type=1&pid='.$payt['id']) ?>'" value="查看重做详情">        
        <?php endif;?>   
	<?php endif;?>                
</div>
</form>
</div>

<div class="bk15"></div>
<div id="div_setting_5" class="contentList division pad-10">
	<table width="100%" cellspacing="0" cellpadding="0" border="0" class="gridlist"> 
		<thead>
		 <tr>
		  <th style="width:50px;">操作者</th>
		  <th style="width:150px;">操作时间</th>
		  <th style="width:50px;">订单状态</th>
		  <th style="width:50px;">支付状态</th>
		  <th style="width:100px;">配送状态</th>
		  <th style="width:500px;">备注 <?php echo $order['payOrderNum'] ? ' &nbsp;<font color="red">支付流水号：(' .$order['payOrderNum'].')</font>' : '' ?></th>
		 </tr> 
		</thead> 
		<tbody>
		<?php 
			if(isset($order['logs']) && $order['logs']):
				foreach ($order['logs'] as $log):
		?>
		  <tr>
		   <td align="center"><?php echo $log['action_name'];?></td> 
		   <td align="center"><?php echo date('Y-m-d H:i:s', $log['action_time']);?></td> 
		   <td align="center"><?php echo OrderModel::$orderStatusCn[$log['order_status']];?></td> 
		   <td align="center"><?php echo OrderModel::$paymentStatus[$log['payment_status']];?></td> 
		   <td align="center"><?php echo $log['shipping_status']==99 ? '配货中' : OrderModel::$shippingStatus[$log['shipping_status']];?></td> 
		   <td>
           <?php if($log['pro_type'] == 1):?>
                    <?php echo '取消选项:';?>
                    <?php if($log['type'] == 0):?>没选择<?php endif;?>
                    <?php if($log['type'] == 1):?>I'd like to reorder later<?php endif;?>
                    <?php if($log['type'] == 2):?>Accidentally clicked the "place order" button<?php endif;?>
                    <?php if($log['type'] == 3):?>Incorrectly entered the information and options<?php endif;?>
                    <?php if($log['type'] == 4):?>The price is too high<?php endif;?>
                    <?php echo '  其他原因:';?>
                    <?php echo trim($log['action_notice']) ? $log['action_notice'] : '无'?>
           <?php else:?>
		       <?php echo $log['action_notice'];?>
           <?php endif;?>
           </td> 
		  </tr>
		<?php 
				endforeach;
			endif;
		?>
		</tbody> 
	</table>
</div>
</div>
</body>
</html>
<script type="text/javascript">
function eidt_process_type(order_item_id){
	if(order_item_id){	
		art.dialog.data('width', 300);
		art.dialog.data('height', 200);
		art.dialog.open('<?php echo U('Order/edit_process_type')?>&order_item_id='+order_item_id,{lock:true,title:'修改工艺类型',width:300,height:200,yesText:'关闭',background: '#000',opacity: 0.45});
	}
}
function eidt_order_attribute(order_item_id,measure_id){
	if(order_item_id && measure_id){	
		art.dialog.open('<?php echo U('Order/eidt_order_attribute')?>&order_item_id='+order_item_id+'&measure_id='+measure_id+'&type=1',{lock:true,title:'修改订单属性',width:800,height:400,yesText:'关闭',background: '#000',opacity: 0.45});
	}
}
function eidt_order_attribute_new(order_item_id,measure_id){
	if(order_item_id && measure_id){	
		art.dialog.data('width', 1000);
		art.dialog.data('height', 900);
		art.dialog.open('<?php echo U('Order/eidt_order_attribute')?>&order_item_id='+order_item_id+'&measure_id='+measure_id+'&type=2',{lock:true,title:'查看客人选项',width:600,height:900,yesText:'关闭',background: '#000',opacity: 0.45});
	}
}

$(function(){
	$('#discount_amount_submit').click(function(){
		var order_id = $('#order_id').val();
		var discount = parseFloat($('#discount_amount').val());
		if(discount == 'NaN' || discount == '0' || discount == '0.00'){
			return false;
		}
		$.getJSON('<?php echo U('order/change_discount_amount_ajax')?>',{discount_amount:discount,oid:order_id},function(result){
			if(result.error){
				alert(result.message);
			}else{
				$('#pay_amount_html').html(result.amount);
			}
			});
		});

})
//function select_area(pid)
//{
//	$.getJSON('<?php echo U('user/public_area_ajax');?>',{pid:pid},function(area){
//		html = '<option value="0" selected>请选择省份</option>';
//		if(area != -1){
//			var key = '';
//			for(key in area){
//				html += '<option value="'+area[key].id+'">'+area[key].name+'</option>';
//			}
//			$('#province').attr('disabled',false);
//		}else{
//			$('#province').attr('disabled',true);
//		}
//		$('#province').html(html);
//	});
//}
//function add_new_product(){
//	product_sn = $('#product_sn').val();
//	oid = $('#order_id').val();
//	if(product_sn){
//		window.top.art.dialog({title:'订单添加新产品', id:'edit', iframe:'/admin/order/get_product_info_ajax/oid/'+oid+'/sn/'+product_sn ,width:'500px',height:'400px'}, 	function(){var d = window.top.art.dialog({id:'edit'}).data.iframe;
//		var form = d.document.getElementById('dosubmit');form.click();return false;}, function(){window.top.art.dialog({id:'edit'}).close()});
//	}
//}

</script>
<script type="text/javascript">
    <!--
    function edit(vid, name,user_id,order_id) {
        window.top.art.dialog({title:'修改--'+name, id:'edit', iframe:'<?php echo U('measure/measure_edit');?>&id='+vid+'&user_id='+user_id+'&order_id='+order_id,width:'700px',height:'400px'}, 	function(){var d = window.top.art.dialog({id:'edit'}).data.iframe;
            var form = d.document.getElementById('dosubmit');form.click();return false;}, function(){window.top.art.dialog({id:'edit'}).close()});
    }
    //-->
</script>
